export const useStaticTypeDictionaries = function(){
  const KEYS = {
    STD_CONFIG: {
      BUSS_TYPE_I: {
        31: { label: "原材料入库", type: "primary" },
        32: { label: "成品入库", type: "primary" },
        33: { label: "成品退货入库", type: "primary" },
        34: { label: "其他入库", type: "primary" },
        51: { label: "原材料出库", type: "primary" },
        52: { label: "成品出库", type: "primary" },
        53: { label: "其他出库", type: "primary" },
        54: { label: "原材料退货出库", type: "primary" }
      },
      WARN_STATE: {
        0: { label: "未报警", type: "primary" },
        1: { label: "已报警", type: "error" }
      },
      BUSS_TYPE_II2: {
        2: { label: "盘盈入库", type: "primary" },
        3: { label: "回水登记入库", type: "primary" },
      },
      BUSS_TYPE_II3: {
        4: { label: "生产入库", type: "primary" }
      },
      BUSS_TYPE_OI: {
        2: { label: "盘亏出库", type: "primary" },
        3: { label: "损耗出库", type: "primary" },
        4: { label: "销售用水申请出库", type: "primary" },
      },
      BUSS_TYPE_PI:{
        1: { label: "销售换货出库", type: "primary" },
        5: { label: "成品销售出库", type: "primary" },
      },
      IIO_RECIPE_STATE: {
        0: { label: "未生效", type: "info" },
        1: { label: "已生效 ", type: "primary" },
        2: { label: "入库中 ", type: "warning" },
        3: { label: "已入库 ", type: "success" },
      },
      IOO_RECIPE_STATE: {
        0: { label: "未生效", type: "info" },
        1: { label: "已生效 ", type: "primary" },
        2: { label: "出库中 ", type: "warning" },
        3: { label: "已出库 ", type: "success" },
      },
      STOCK_STATE: {
        0: { label: "未出库 ", type: "warning" },
        1: { label: "已出库 ", type: "success" },
      },
      STORAGE_STATE: {
        1: { label: "入库 ", type: "warning" },
        2: { label: "出库 ", type: "success" },
      },
      SG_TYPE: {
        1: { label: "原材料领料", type: "primary" },
        // 2: { label: "用水领料", type: "warning", show: false },
        3: { label: "损耗", type: "error" }
      },
      BC_TYPE: {
        1: { label: "月结", type: "error" },
        2: { label: "非月结 ", type: "warning" },
        3: { label: "其他 ", type: "error" }
      },
      BC_TYPES: [
        { label: "月结", type: "error" },
        { label: "非月结 ", type: "warning" },
        { label: "其他 ", type: "error" }
      ],
      BW_STATE: {
        0: { label: "未生效", type: "info" },
        1: { label: "已生效", type: "primary" },
        2: { label: "入库中 ", type: "warning" },
        3: { label: "已入库 ", type: "success" },
      },
      ORDER_RECIPE_STATE: {
        0: { label: "未生效", type: "info" },
        1: { label: "销售驳回", type: "error" },
        2: { label: "销售通过 ", type: "warning" },
        3: { label: "财务驳回 ", type: "error" },
        4: { label: "财务通过 ", type: "warning" },
        5: { label: "已生效 ", type: "primary" },
        6: { label: "已完成 ", type: "success" }
      },
      APPROVE_STATE: {
        0: { label: "待审批", type: "info" },
        1: { label: "驳回", type: "error" },
        2: { label: "通过", type: "success" }
      },
      PURCHASE_STATE: {
        0: { label: "未被采购", type: "info" },
        1: { label: "部分采购", type: "primary" },
        2: { label: "全部采购", type: "success" }
      },
      RECIPE_STATE: {
        0: { label: "未生效", type: "info" },
        1: { label: "已生效", type: "primary" },
        2: { label: "完成", type: "success" }
      },
      WD_STATE: {
        0: { label: "未派工", type: "info" },
        2: { label: "已派工", type: "success" },
        1: { label: "部分派工", type: "warning" }
      },
      BWL_IN_STATE: {
        0: { label: "未入库", type: "info" },
        1: { label: "入库中", type: "warning" },
        2: { label: "已入库", type: "success" }
      },
      BWL_OUT_STATE: {
        0: { label: "未出库", type: "info" },
        1: { label: "出库中", type: "warning" },
        2: { label: "已出库", type: "success" }
      },
      PRIORITY: {
        0: { label: "一般", type: "success" },
        1: { label: "紧急", type: "warning" },
        2: { label: "非常紧急", type: "error" }
      },
      ADUIT_STATE: {
        1: { label: "审核通过", type: "success" },
        2: { label: "审核驳回", type: "error" }
      },
      ROW_STATE: {
        0: { label: "草稿", type: "info" },
        1: { label: "生效", type: "primary" },
        2: { label: "审核", type: "success" }
      },
      RE_STATE: {
        0: { label: "草稿", type: "info" },
        1: { label: "已提交", type: "primary" },
        2: { label: "已完成", type: "success" },
        9: { label: "已撤回", type: "error" }
      },
      SYNC_STATE: {
        0: { label: "未同步", type: "info" },
        1: { label: "同步失败", type: "error" },
        2: { label: "同步成功", type: "success" }
      },
      PTP_STATE: {
        0: { label: "正常", type: "success" },
        1: { label: "停用", type: "info" }
      },
      BCD_STATE: {
        1: { label: "正常", type: "success" },
        0: { label: "停用", type: "info" }
      },
      ARI_STATE: {
        0: { label: "正常", type: "success" },
        1: { label: "停用", type: "info" }
      },
      WMR_STATE: {
        2: { label: "待申请", type: "info" },
        0: { label: "未确认", type: "info" },
        1: { label: "已确认", type: "success" }
      },
      WT_STATE: {
        0: { label: "未下达", type: "info" },
        1: { label: "已下达", type: "primary" },
        2: { label: "执行中", type: "warning" },
        3: { label: "已完工", type: "success" },
        4: { label: "已作废", type: "error" }
      },
      BWA_TYPE: {
        1: { label: "物料", type: "info" },
        2: { label: "成品", type: "success" }
      },
      SENDPARS: {
        1: { label: "处方号", type: "info" },
        2: { label: "参数", type: "success" },
        3: { label: "手动", type: "success" }
      },
      Y1N0: {
        1: { label: "是", type: "success" },
        0: { label: "否", type: "info" }
      },
      Y1N2: {
        1: { label: "是", type: "success" },
        2: { label: "否", type: "info" }
      },
      QOL: {
        "1": { label: "合格", type: "success" },
        "2": { label: "不合格", type: "info" }
      },
      CHANGE_NO_TYPE: {
        0: {label: '新增', type:'primary'},
        1: {label: '更新', type:'success'},
        2: {label: '删除', type:'danger'},
      },
      WMR_STATE_VERIFFY: {
        0: { label: "已解决", type: "success" },
        1: { label: "未解决", type: "danger" }
      },
      WMR_TYPE: {
        0: { label: "上料", type: "success" },
        1: { label: "下料", type: "danger" },
        2: { label: "领料", type: "danger" },
        3: { label: "退料", type: "danger" }
      },
      PROD_STATE: {
        0: { label: "待下达", type: "info" },
        1: { label: "已完工", type: "success" }
      },
      COMPLETE_STATE: {
        0: { label: "未完工", type: "info" },
        1: { label: "已完工", type: "success" }
      },
    }
  }

  const L = function (type,key){
    let value = ""
    let values = KEYS.STD_CONFIG[type]
    if(values && values[key]){
      value = values[key].label || ""
    }
    return value
  }

  const O2A = function(KEYS = {}) {
    const data = []
    Object.entries(KEYS).map(([key,value])=>{
      const {label = "" } = value
      let obj = {}
      obj['label'] = label
      obj['value'] = key
      data.push(obj)
    })

    return data
  }

  return {
    L,
    O2A,
    KEYS:KEYS.STD_CONFIG
  }
}
